Key press detecting circuit and method for detecting the status of multiple keys through a single pin

ABSTRACT

A key press detecting circuit and method detect the status of multiple keys through a single pin. In an embodiment, a constant current is provided to apply to a key module through a single pin, to generate a voltage at the single pin that is related to the equivalent resistance of the key module observed from the single pin, and the voltage of the single pin is compared with a set of reference values to identify the status of the plurality of keys. In another embodiment, a variable current is provided to apply to a key module through a single pin in such a way that the variable current is adjusted to maintain a constant voltage at the single pin, and the variable current is compared with a set of reference values to identify the status of the plurality of keys.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a Divisional of co-pending application Ser. No. 13/889,474, filed on May 8, 2013, for which priority is claimed under 35 U.S.C. §120; and this application claims priority of Application No. 101116725 filed in Taiwan, R.O.C. on May 10, 2012 under 35 U.S.C. §119, the entire contents of all of which are hereby incorporated by reference.

FIELD OF THE INVENTION

The present invention is related generally to a key press detecting circuit and method. More particularly, the present invention is related to a key press detecting circuit and method for detecting the status of multiple keys through a single pin.

BACKGROUND OF THE INVENTION

As shown in FIG. 1, to detect the status of multiple keys B1, B2 and B3, a conventional key detector chip 10 needs the same number of pins P1, P2 and P3 as the number of the keys B1, B2 and B3, to be connected to the key circuits 12, 14 and 16, respectively, where the keys B1, B2 and B3 are provided, and each of the key circuits 12, 14 and 16 has a single key B1, B2 or B3 connected in series (as the key circuit 16) or in parallel (as the key circuits 12 and 14) with a resistor R1, R2 or R3. When any of the keys B1, B2 and B3 is pressed, the equivalent resistance of the corresponding key circuit 12, 14 or 16 observed from the pins P1, P2 or P3 changes. In the back-end of each of the pins P1, P2 and P3 is provided an individual key press detecting circuit 18, 20 or 22 for detecting whether the corresponding key B1, B2 or B3 is pressed. Since each key needs a pin and a key press detecting circuit for implementing the key press detecting function, the costs and the size of a conventional key detector chip both are increased in the applications where more keys are used.

SUMMARY OF THE INVENTION

An objective of the present invention is to provide a key press detecting circuit and method for detecting the status of multiple keys through a single pin.

Another objective of the present invention is to provide an input device using a single pin for detecting the status of multiple keys.

According to the present invention, a constant current is provided to apply to a key module through a single pin, to generate a voltage at the single pin that is related to the equivalent resistance of the key module observed from the single pin, and the voltage of the single pin is compared with a set of reference values to identify the status of the plurality of keys.

According to the present invention, a variable current is provided to apply to a key module through a single pin in such a way that the variable current is adjusted to maintain a constant voltage at the single pin, and the variable current is compared with a set of reference values to identify the status of the plurality of keys.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other objectives, features and advantages of the present invention will become apparent to those skilled in the art upon consideration of the following description of the preferred embodiments of the present invention taken in conjunction with the accompanying drawings, in which:

FIG. 1 shows a conventional key detector chip for detecting the status of multiple keys;

FIG. 2 is a circuit diagram of a first embodiment according to the present invention; and

FIG. 3 is a circuit diagram of a second embodiment according to the present invention.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 2 is a circuit diagram of a first embodiment according to the present invention, in which a key press detecting circuit 26 inside of a key detector chip 24 and a key module 28 external to the key detector chip 24 are connected to each other through a single pin Ps to establish an input device, and the key press detecting circuit 26 detects the status of multiple keys in the key module 28 through the single pin Ps.

To illustrate the operation of the key press detecting circuit 26 shown in FIG. 2, it is assumed in this embodiment that the key module 28 includes resistors R4, R5 and R0 connected in series between the single pin Ps and a ground terminal GND, a key B4 is connected in parallel to the resistor R4, a key B5 is connected in parallel to the resistor R5, and the corresponding resistances have the relationship R4=R0=½R5. Therefore, the equivalent resistance of the key module 28 observed from the single pin Ps varies with how the keys B4 and B5 are pressed. In further details, when neither of the keys B4 and B5 is pressed, the equivalent resistance of the key module 28 is equal to R4+R5+R0=4×R0; when only the key B4 is pressed, the equivalent resistance of the key module 28 is equal to R5+R0=3×R0; when only the key B5 is pressed, the equivalent resistance of the key module 28 is equal to R4+R0=2×R0; and when both the keys B4 and B5 are pressed, the equivalent resistance of the key module 28 is equal to R0.

In this embodiment, the key press detecting circuit 26 includes a current source 30 connected to the single pin Ps, for providing a constant current Ic to apply to the key module 28 through the single pin Ps, and thus the voltage V1 of the single pin Ps is equal to the multiplication of the constant current Ic and the equivalent resistance of the key module 28 observed from the single pin Ps, V1=Ic×R(28). Since the current Ic is constant, and the equivalent resistance of the key module 28 varies with how the keys B4 and B5 are pressed, it can detect the status of the keys B4 and B5 from the voltage V1 of the single pin Ps. The key press detecting circuit 26 further includes a voltage comparator 32 connected to the single pin Ps to compare the voltage V1 of the single pin Ps with a set of reference values Vref to generate an output signal Sout representative of the status of the keys B4 and B5.

Preferably, the key press detecting circuit 26 further includes a charging/discharging circuit 34 connected to the single pin Ps, for pre-charging or pre-discharging the single pin Ps to quickly stabilize the voltage V1 of the single pin Ps, and thereby speed up the response of the key press detecting circuit 26. In this embodiment, the charging/discharging circuit 34 includes a high-side transistor M1 connected between a voltage source VDD and the single pin Ps, and a low-side transistor M2 connected between the single pin Ps and a ground terminal GND. The transistors M1 and M2 act as switches and are controlled by control signals Sm1 and Sm2, respectively. When the transistor M1 is on, the voltage source VDD charges the single pin Ps through the transistor M1; and when the transistor M2 is on, the single pin Ps discharges to the ground terminal GND through the transistor M2. In other embodiments, the charging/discharging circuit 34 contains only one of the high-side transistor M1 and the low-side transistor M2, depending on pre-charging or pre-discharging demand.

In various applications of the key detector chip 24, an external key module may cause the single pin Ps to become floating. For example, as shown in FIG. 1, when the key B3 in the key circuit 16 is not pressed, the pin P3 becomes floating, causing the voltage of the pin P3 to fluctuate. For preventing this, the key press detecting circuit 26 shown in FIG. 2 further includes an initializing resistor Rini or a switch SW1 or both of them connected between the single pin Ps and the ground terminal GND, for initializing the voltage V1 of the single pin Ps, thereby preventing it from fluctuating. Preferably, the key press detecting circuit 26 has an initializing resistor Rini and a switch SW1 connected in series between the single pin Ps and the ground terminal GND, for initializing the voltage V1 of the single pin Ps when the switch SW1 is turned on. When using the key detector chip 24, a user may determine whether the voltage of the single pin Ps will be fluctuating according to the key module 28, and then determine whether to use an enable signal Sen to initialize the voltage V1 of the single pin Ps accordingly. Alternatively, in other embodiments, an initializing resistor Rini or a switch SW1 or serially connected initializing resistor Rini and switch SW1 is connected between the single pin Ps and a voltage source, e.g. VDD, instead of between the single pin Ps and the ground terminal GND.

FIG. 3 is a circuit diagram of a second embodiment according to the present invention, in which a key press detecting circuit 38 inside of a key detector chip 36 and a key module 40 external to the key detector chip 36 are connected to each other through a single pin Ps to establish an input device, and the key press detecting circuit 38 detects the status of multiple keys in the key module 40 through the single pin Ps.

To illustrate the operation of the key press detecting circuit 38 shown in FIG. 3, it is assumed in this embodiment that the key module 40 includes a key B6 and a resistor R6 connected in series between the single pin Ps and a ground terminal GND, and a key B7 and two resistors R7 and R0 connected in series between the single pin Ps and the ground terminal GND, while the resistor R0 is connected between the single pin Ps and the key B7, and the corresponding resistances have the relationship R6=R7=R0. Therefore, the equivalent resistance of the key module 40 observed from the single pin Ps varies with how the keys B6 and B7 are pressed. In further details, when only the key B6 is pressed, the equivalent resistance of the key module 40 is equal to R6=R0; when only the key B7 is pressed, the equivalent resistance of the key module 40 is equal to R7+R0=2×R0; when both the keys B6 and B7 are pressed, the equivalent resistance of the key module 40 is equal to 2/3 R0, and when neither of the keys B6 and B7 is pressed, the single pin Ps becomes floating. As explained above in the description of the embodiment shown in FIG. 2, by connecting an initializing resistor Rini or a switch SW1 or both of them between the single pin Ps and a ground terminal GND or a voltage source, fluctuation of the voltage V1 of the single pin Ps can be prevented. Alternatively, in other embodiments, the initializing resistor Rini may be arranged outside the key detector chip 36, for example, in the key module 40 or using an external resistor connected to the single pin Ps.

In this embodiment, the key press detecting circuit 38 includes a constant voltage control circuit 42 connected to the single pin Ps, and a current source 44 for providing a variable current I1 to apply to the single pin Ps through the constant voltage control circuit 42. The constant voltage control circuit 42 maintains the voltage V1 of the single pin Ps at a reference value Vc, and thus variation of the equivalent resistance of the key module 40 will cause the variable current I1 to change as I1=Vc/R(40). In other words, the equivalent resistance of the key module 40 reflects the status of the keys B6 and B7, and the variable current I1 reflects the equivalent resistance of the key module 40. For detecting the variable current I1, the current source 44 includes a current mirror for mirroring the variable current I1 to generate a mirror current I2, and the mirror current I2 is compared with a set of reference values by a current comparator 46 to generate an output signal Sout representative of the status of the keys B6 and B7.

In this embodiment, the current comparator 46 includes a reference resistor Rref connected between the current source 44 and a ground terminal GND for converting the mirror current I2 into a voltage V2=I2×Rref, and a voltage comparator 32 for comparing the voltage V2 with the set of reference values Vref to generate the output signal Sout. In this embodiment, the constant voltage control circuit 42 has a transistor M3 and a resistor R8 connected in series between the current source 44 and the single pin Ps, and an operational amplifier 48 for controlling the transistor M3 to thereby adjust the variable current I1. The operational amplifier 48 has a first input terminal receiving the reference voltage Vc, a second input terminal connected to the single pin Ps, and an output terminal providing an error signal Sd to a gate of the transistor M3. Such a circuit can maintain the voltage V1 of the single pin Ps at the reference value Vc. When the equivalent resistance of the key module 40 varies, due to the virtual short circuit between the two input terminals of the operational amplifier 48, the error signal Sd will change and thus control the transistor M3 to adjust the variable current I1 in order to maintain the voltage V1 of the single pin Ps at the reference value Vc. The change of the variable current I1 is reflected to the mirror current I2, and in turn reflected to the output signal Sout. Preferably, the constant voltage control circuit 42 further includes a resistor R9 connected between the input terminal of the operational amplifier 48 and the single pin Ps.

The same as the embodiment shown in FIG. 2, the key press detecting circuit 38 in this embodiment may further include a charging/discharging circuit 34 connected to the single pin Ps, for pre-charging or pre-discharging the single pin Ps to quickly stabilize the voltage V1 of the single pin Ps, and thereby speed up the response of the key press detecting circuit 38. Likewise, the key press detecting circuit 38 in this embodiment may further include an initializing resistor Rini or a switch SW1 or both of them connected between the single pin Ps and the ground terminal GND, for initializing the voltage V1 of the single pin Ps, thereby preventing it from fluctuating. The operations of the charging/discharging circuit 34, the initializing resistor Rini and the switch SW1 are the same as that described for the embodiment shown in FIG. 2.

As demonstrated in the above embodiments, the present invention needs only a single pin to detect the status of multiple keys, and the multiple keys can have any arrangement with resistors to establish a key module, provided that how they are pressed can change the equivalent resistance of the key module. In applications where more keys are used, the present invention has the advantage of saving many pins in the key detector chip, thereby significantly reducing the costs for packaging. Also, as the present invention needs only a key press detecting circuit with multiple reference values, area of the key detector chip can be minimized. While the present invention has been described in conjunction with preferred embodiments thereof, it is evident that many alternatives, modifications and variations will be apparent to those skilled in the art. Accordingly, it is intended to embrace all such alternatives, modifications and variations that fall within the spirit and scope thereof as set forth in the appended claims. 

What is claimed is:
 1. A key press detecting circuit for detecting a status of a plurality of keys which are connected in series or in parallel with a plurality of resistors to establish a key module, the key press detecting circuit comprising: a single pin connected to the key module; a constant voltage control circuit connected to the single pin, setting the single pin at a first voltage by adjusting a first current; a current source connected to the constant voltage control circuit, providing the first current and a second current related to the first current; and a current comparator connected to the current source, comparing the second current with a set of reference values to generate an output signal representative of the status of the plurality of keys.
 2. The key press detecting circuit of claim 1, wherein the current source comprises a current mirror mirroring the first current to generate the second current.
 3. The key press detecting circuit of claim 1, wherein the constant voltage control circuit comprises: a transistor and a resistor connected in series between the current source and the single pin; and an operational amplifier having a first input terminal receiving a reference voltage equal to the first voltage, a second input terminal connected to the single pin, and an output terminal providing an error signal applied to a gate of the transistor, thereby adjusting the first current.
 4. The key press detecting circuit of claim 1, wherein the current comparator comprises: a resistor connected between the current source and a ground terminal, converting the second current into a second voltage; and a voltage comparator connected to the resistor, comparing the second voltage with the set of reference values to generate the output signal.
 5. The key press detecting circuit of claim 1, further comprising a charging/discharging key press detecting circuit connected to the single pin, being controlled to pre-charge or pre-discharge the single pin.
 6. The key press detecting circuit of claim 1, further comprising an initializing resistor, a switch, or a serially-connected combination thereof, connected between the single pin and a ground terminal or a voltage source, being controlled to initialize the voltage of the single pin.
 7. A key press detecting method for detecting a status of a plurality of keys which are connected in series or in parallel with a plurality of resistors to establish a key module, the key press detecting method comprising steps of: A.) connecting a single pin to the key module; B.) setting the single pin at a first voltage by adjusting a first current; C.) providing the first current and a second current related to the first current; and D.) comparing the second current with a set of reference values for generating an output signal representative of the status of the plurality of keys.
 8. The key press detecting method of claim 7, wherein the step C comprises the step of mirroring the first current to generate the second current.
 9. The key press detecting method of claim 7, wherein the step D comprises steps of: converting the second current into a second voltage; and comparing the second voltage with the set of reference values for generating the output signal.
 10. The key press detecting method of claim 7, further comprising the step of pre-charging or pre-discharging the single pin, for speeding up response of detecting the status of the plurality of keys.
 11. The key press detecting method of claim 7, further comprising the step of initializing the voltage of the single pin.
 12. An input device comprising: a plurality of keys and a plurality of resistors configured to establish a key module, the key module having an equivalent resistance dependent on the status of the plurality of keys; a single pin connected to the key module; a constant voltage control circuit connected to the single pin, setting the single pin at a first voltage by adjusting a first current; a current source connected to the constant voltage control circuit, providing the first current and a second current related to the first current; and a current comparator connected to the current source, comparing the second current with a set of reference values to generate an output signal representative of the status of the plurality of keys.
 13. The input device of claim 12, wherein the current source comprises a current mirror mirroring the first current to generate the second current.
 14. The input device of claim 12, wherein the constant voltage control circuit comprises: a transistor and a resistor connected in series between the current source and the single pin; and an operational amplifier having a first input terminal receiving a reference voltage equal to the first voltage, a second input terminal connected to the single pin, and an output terminal providing an error signal applied to a gate of the transistor, thereby adjusting the first current.
 15. The input device of claim 12, wherein the current comparator comprises: a resistor connected between the current source and a ground terminal, converting the second current into a second voltage; and a voltage comparator connected to the resistor, comparing the second voltage with the set of reference values to generate the output signal.
 16. The input device of claim 12, further comprising a charging/discharging circuit connected to the single pin, being controlled to pre-charge or pre-discharge the single pin.
 17. The input device of claim 12, further comprising an initializing resistor, a switch, or a serially-connected combination thereof, connected between the single pin and a ground terminal or a voltage source, being controlled to initialize the voltage of the single pin. 